<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="edu.njust.LabSystem.entity.*,edu.njust.LabSystem.Service.*" %>
<%@ page import="java.util.List" %>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <%
        String uid = (String) session.getAttribute("uid");
        IStudentService service = new IStudentService();
        Student student = service.getStudentById(uid);
    %>
</head>

<body>
<%--    表1：学生课表--%>
<div class="table-container">
    <div class="table-top">
        <span class="table-title">学生课表</span>
    </div>
    <div class="table-main">
        <div class="main_left">
            <ul id="nav1" class="">
                <li id="item1" onclick="itemClick1()" class="unselected-item"><a>实验</a></li>
            </ul>
        </div>
        <div class="main_right">
            <table id="shiyanke" class="table table-bordered class-table">
                <tr class="head_tr">
                    <td></td>
                    <td>
                        <p>周一</p>
                        <p>11/15</p>
                    </td>
                    <td>
                        <p>周二</p>
                        <p>11/16</p>
                    </td>
                    <td>
                        <p>周三</p>
                        <p>11/17</p>
                    </td>
                    <td>
                        <p>周四</p>
                        <p>11/18</p>
                    </td>
                    <td>
                        <p>周五</p>
                        <p>11/19</p>
                    </td>
                    <td>
                        <p>周六</p>
                        <p>11/20</p>
                    </td>
                    <td>
                        <p>周日</p>
                        <p>11/21</p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p>08:00</p>
                        <p>10:25</p>
                    </td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td><p>10:40</p>
                        <p>12:15</p></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td class="selected-item"><%
                        String cid = student.getClassid();
                        ExperimentService experimentService = new ExperimentService();
                        List<Experiment> experiments = experimentService.getExperimentByClassid(cid);
                        LabAppointmentService labAppointmentService = new LabAppointmentService();

                        if (experiments == null || experiments.size() < 1) {
                            //out.print("<script language='javascript'>alert('没有数据');</script>");
                        } else {
                            for (Experiment experiment : experiments) {
                                String eid = experiment.getId();
                                LabAppointment labAppoint = labAppointmentService.getLabAppointmentByExperiment(eid);
                                if (experiment.isOpen() == false) {
                                    String labId = labAppoint.getLab();
                                    LabService labService = new LabService();
                                    Lab lab = labService.getByLabId(labId);
                                    //String lid=experiment.getLab();lid.getName();
                    %>
                        <%=experiment.getName()%>
                        <%=experiment.getTeacher()%><br>
                        <%=lab.getName()%>

                        <%=labAppoint.getAppoint_date()%><br>
                        第<%=labAppoint.getAppoint_time()%>大节
                        <%
                                    }
                                }
                            }
                        %></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td><p>14:00</p>
                        <p>15:35</p></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td><p>15:50</p>
                        <p>18:15</p></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td><p>19:00</p>
                        <p>21:25</p></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
            </table>
        </div>
    </div>
</div>

</body>
</html>